package com.example.kafka.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ProduceController {
    @Autowired
    private KafkaTemplate<String, String> kafkaTemplate;

    @GetMapping("/produce")
    public String produce(@RequestParam("message") String message) {
        kafkaTemplate.send("test", message);
        return "success";
    }
}
